package com.bwie.user.controller;

import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 根据用户名查询
     */
    @PostMapping("/QueryByUserName")
    public Result<User> QueryByUserName(@RequestParam String userName){
        User user = userService.QueryByUserName(userName);
        return Result.success(user);
    }
    /**
     * 根据用户ID查询
     */
    @PostMapping("/getUser")
    public Result<User> getUser(@RequestParam Integer userId){
        User user = userService.getUser(userId);
        return Result.success(user);
    }
}
